<script setup>
import { getArticleChannels } from '@/api/article.js'
import { ref } from 'vue'
defineProps({
  //   modelValue: {
  //     type: [Number, String]
  //   }
  cid: {
    type: [Number, String]
  },
  width: {
    type: [String]
  }
})
// const emit = defineEmits(['update:modelValue'])
const emit = defineEmits(['update:cid'])
const channelList = ref([])
const getChannelList = async () => {
  const res = await getArticleChannels()
  //   console.log(res.data.data)
  channelList.value = res.data.data
}
getChannelList()
</script>
<template>
  <el-select
    style="width: 13vw"
    :modelValue="cid"
    :style="{ width }"
    @update:modelValue="emit('update:cid', $event)"
  >
    <el-option
      v-for="channel in channelList"
      :label="channel.cate_name"
      :value="channel.id"
      :key="channel.id"
    >
    </el-option>
  </el-select>
</template>
